package com.bio.service.user.impl;

import com.bio.dao.user.CompanyDao;
import com.bio.dao.user.PositionDao;
import com.bio.dao.user.UserDAO;
import com.bio.entity.user.Company;
import com.bio.service.impl.AbstractService;
import com.bio.service.user.CompanyService;

public class CompanyServiceImpl  extends AbstractService<Company, CompanyDao> implements CompanyService{

	public CompanyServiceImpl(CompanyDao dao) {
		super(dao);
	}

	private UserDAO userDAO;
	
	private PositionDao positionDao;
	
	@Override
	public void remove(Long companyId) {
		//根据公司id先删除员工
		userDAO.removeUsersByCompany(companyId);
		//根据公司id删除职位
		positionDao.removePositionsByCompany(companyId);
		//删除公司
		this.dao.remove(companyId);
	}

	public void setUserDAO(UserDAO userDAO) {
		this.userDAO = userDAO;
	}

	public void setPositionDao(PositionDao positionDao) {
		this.positionDao = positionDao;
	}

}
